# image address
ARG TRINO_VERSION=435
FROM curlimages/curl AS curl

WORKDIR /home/curl_user/
RUN curl -L https://repo.huaweicloud.com/repository/maven/huaweicloudsdk/com/huaweicloud/obs/hadoop-huaweicloud/3.1.1-hw-53.7/hadoop-huaweicloud-3.1.1-hw-53.7.jar  \
    --output /home/curl_user/hadoop-huaweicloud-3.1.1-hw-53.7.jar


FROM trinodb/trino:${TRINO_VERSION}
ARG TRINO_VERSION
# add clickhouse jdbc into trino's classpath
ADD --chown=trino:trino --chmod=644 resources/trino-main-${TRINO_VERSION}.jar /lib/trino/lib/trino-main-${TRINO_VERSION}.jar
# ADD --chown=trino:trino --chmod=644 resources/paimon-trino-422-0.6-SNAPSHOT.jar /lib/trino/plugin/paimon/paimon-trino-422-0.6-SNAPSHOT.jar
ADD --chown=trino:trino --chmod=644 https://repository.apache.org/content/groups/snapshots/org/apache/paimon/paimon-trino-422/0.7-SNAPSHOT/paimon-trino-422-0.7-20231220.075518-12.jar /lib/trino/plugin/paimon/paimon-trino-422-0.7.jar

ADD --chown=trino:trino --chmod=644 https://repo.maven.apache.org/maven2/org/apache/flink/flink-shaded-hadoop-2-uber/2.8.3-10.0/flink-shaded-hadoop-2-uber-2.8.3-10.0.jar /lib/trino/plugin/paimon/flink-shaded-hadoop-2-uber-2.8.3-10.0.jar
ADD --chown=trino:trino --chmod=644 https://repository.apache.org/content/groups/snapshots/org/apache/paimon/paimon-s3/0.7-SNAPSHOT/paimon-s3-0.7-20240106.002048-46.jar /lib/trino/plugin/paimon/paimon-s3-0.7.jar

COPY --chown=trino:trino --chmod=644 --from=curl /home/curl_user/hadoop-huaweicloud-3.1.1-hw-53.7.jar /lib/trino/plugin/paimon/hadoop-huaweicloud-3.1.1-hw-53.7.jar
COPY --chown=trino:trino --chmod=644 --from=curl /home/curl_user/hadoop-huaweicloud-3.1.1-hw-53.7.jar /lib/trino/plugin/hive/hdfs/hadoop-huaweicloud-3.1.1-hw-53.7.jar
COPY --chown=trino:trino --chmod=644 --from=curl /home/curl_user/hadoop-huaweicloud-3.1.1-hw-53.7.jar /lib/trino/plugin/iceberg/hdfs/hadoop-huaweicloud-3.1.1-hw-53.7.jar
